scrolledwindow: Set the scrollbar as "over" immediately during slider grabs
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 15 Sep 2015 15:18:20 +0000 (17:18 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 16 Sep 2015 17:14:10 +0000 (19:14 +0200)
Otherwise it's attempted through a timeout, which gets cancelled early after,
and the slider disappears after a while with no mouse activity despite the
ongoing implicit grab.

Once the grab is finished, check_update_scrollbar_proximity() will be called
again on both scrollbars, and the fade out animation will be triggered as a
result.

https://bugzilla.gnome.org/show_bug.cgi?id=754745

gtk/gtkscrolledwindow.c

index 3222c7fd23f25d1c01cb60b2779d05e0b56d72d8..814d165e82aab7969e84416f6dbd56c719d6daf9 100644 (file)
@@ -1078,9 +1078,14 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
                                   Indicator         *indicator,
                                   GdkEvent          *event)
 {
-  gboolean indicator_close;
+  gboolean indicator_close, on_scrollbar;
+  GtkWidget *event_widget;
+
+  event_widget = gtk_get_event_widget (event);
 
   indicator_close = event_close_to_indicator (sw, indicator, event);
+  on_scrollbar = (event_widget == indicator->scrollbar &&
+                  event->type != GDK_LEAVE_NOTIFY);
 
   if (indicator->over_timeout_id)
     {
@@ -1088,7 +1093,9 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
       indicator->over_timeout_id = 0;
     }
 
-  if (indicator_close)
+  if (on_scrollbar)
+    indicator_set_over (indicator, TRUE);
+  else if (indicator_close)
     indicator->over_timeout_id = gdk_threads_add_timeout (30, enable_over_timeout_cb, indicator);
   else
     indicator_set_over (indicator, FALSE);